<template>
  <div>
    <div style="width: 20%;">
      <el-form ref="ruleForm" v-loading="loading" :rules="ruleForm" :model="formInfo" label-position="left" label-width="100px">
        <el-form-item label="老师姓名" prop="name">
          <el-input v-model="formInfo.name" type="text" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="手机号码" prop="janitor_name">
          <el-input v-model="formInfo.tel" type="number" maxlength="11" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="所属年级" prop="janitor_name">
          <el-select v-model="formInfo.year_grade_name" style="width: 240px" clearable placeholder="请选择年级">
            <el-option
              v-for="item of 20"
              :key="item"
              :label="item"
              :value="item"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="角色" prop="janitor_name">
          <el-select v-model="SELECT_ROLE[formInfo.role]" clearable placeholder="请选择角色">
            <el-option
              v-for="(item,ins) of SELECT_ROLE"
              :key="ins"
              :label="item"
              :value="item"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="所属班级" prop="janitor_name">
          <el-select v-model="formInfo.class_grade_id" style="width: 240px" clearable placeholder="请选择班级">
            <el-option
              v-for="item of 20"
              :key="item"
              :label="item"
              :value="item"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="家庭住址" prop="janitor_name">
          <el-input v-model="formInfo.address" type="text" placeholder="请输入住址" />
        </el-form-item>
        <el-form-item label="班级邀请码" prop="janitor_name">
          {{ formInfo.class_invite_code }}
        </el-form-item>
      </el-form>
    </div>
    <div style="margin: 5% 0 0 5%;">
      <el-button plain style="margin-right: 3%;" @click="$emit('close')">取消</el-button>
      <el-button type="primary">保存</el-button>
    </div>
  </div>
</template>

<script>
import TableMixins from '@/components/WxTables/mixins'
import FullMixins from '@/components/WxTables/fullMixins'
import { post } from '@/utils/request'

export default {
  name: 'StudentDetail',
  mixins: [TableMixins, FullMixins],
  props: {
    loading: {
      type: Boolean,
      default: false
    },
    isAdd: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      findApi: 'api/adminPortal/teacher/getById',
      formInfo: {},
      ruleForm: {
        name: [
          { required: true, message: '请输入租赁标的名称', trigger: 'blur' }
        ],
        company_id: [
          { required: true, message: '请选择所属公司', trigger: 'blur' }
        ],
        type: [
          { required: true, message: '请选择租赁标的类型', trigger: 'blur' }
        ],
        cost_center_code: [
          { required: true, message: '公司代码+0000+标的代码', trigger: 'blur' }
        ]
      }
    }
  },
  mounted() {

  },
  methods: {
    handleGetInfo() {
      post('api/adminPortal/teacher/getById', {
        id: 1
      }).then((res) => {
        console.log(res)
      })
    }
  }
}
</script>
